<template>
  <!-- 用户页面 -->
  <div>
    <!-- 面包屑导航区 -->
    <myBreadcrumb :breadcrumbData="this.breadcrumbData"></myBreadcrumb>
    <!-- 卡片视图区域 -->
    <el-card shadow="always" :body-style="{ padding: '10px' }">
      <div class="mask">
        <!-- 内容视图 -->
        <el-row :gutter="20" style="height: 100%" v-show="navTabBarIsShow">
          <!-- ************************** -->
          <myAllAchievement v-if="navTabBarMarking.all" />
          <myAwardManage v-if="navTabBarMarking.award" />
          <myEssayManage v-if="navTabBarMarking.essay" />
          <myPatentManage v-if="navTabBarMarking.patent" />
          <myProjectManage v-if="navTabBarMarking.project" />
          <myWorkManage v-if="navTabBarMarking.work" />
        </el-row>
        <!-- 圆圈视图 -->
        <div
          v-if="!navTabBarIsShow"
          class="startCircle"
          :class="[navTabBarIsShow ? 'mainOutAni' : '']"
        >
          <div class="main">
            <span @click="handleProjectClick">项目</span>
            <span @click="handleAwardClick">获奖</span>
            <span @click="handleEssayClick">论文</span>
            <span @click="handlePatentClick">专利</span>
            <span @click="handleWorkClick">著作与教材</span>
            <span @click="handleAllClick">ALL</span>
          </div>
        </div>
      </div>
      <!-- tabBar视图 -->
      <div class="navigationBar" v-show="navTabBarIsShow">
        <div class="main">
          <span
            :class="navTabBarMarking.all ? 'active' : ''"
            @click="tabBarAllClick"
            >ALL</span
          >
          <span
            :class="navTabBarMarking.project ? 'active' : ''"
            @click="tabBarProjectClick"
            >项目</span
          >
          <span
            :class="navTabBarMarking.award ? 'active' : ''"
            @click="tabBarAwardClick"
            >获奖</span
          >
          <span
            :class="navTabBarMarking.essay ? 'active' : ''"
            @click="tabBarEssayClick"
            >论文</span
          >
          <span
            :class="navTabBarMarking.patent ? 'active' : ''"
            @click="tabBarPatentClick"
            >专利</span
          >
          <span
            :class="navTabBarMarking.work ? 'active' : ''"
            @click="tabBarWorkClick"
            >著作与教材</span
          >
        </div>
      </div>
    </el-card>
  </div>
</template>

<script>
import myBreadcrumb from "../../components/myBreadcrumb.vue";
import myPagination from "../../components/myPagination.vue";
import mySearch from "../../components/mySearch.vue";
// 业绩操作
import myAllAchievement from "../../components/admin/myAllAchievement.vue";
// 获奖
import myAwardManage from "../../components/admin/myAwardManage.vue";
import myEssayManage from "../../components/admin/myEssayManage.vue";
import myPatentManage from "../../components/admin/myPatentManage.vue";
import myProjectManage from "../../components/admin/myProjectManage.vue";
import myWorkManage from "../../components/admin/myWorkManage.vue";

import { mapState } from "vuex";
export default {
  name: "myAchievementTransaction",
  components: {
    myBreadcrumb,
    myPagination,
    mySearch,
    myAllAchievement,
    myAwardManage,
    myEssayManage,
    myPatentManage,
    myProjectManage,
    myWorkManage,
  },
  data() {
    return {
      // navTabBar
      navTabBarIsShow: false,
      // 标识
      navTabBarMarking: {
        all: false,
        project: false,
        award: false,
        essay: false,
        patent: false,
        work: false,
      },
      breadcrumbData: ["业绩管理", "业绩办理"],
    };
  },
  methods: {
    handleProjectClick() {
      this.navTabBarIsShow = true;
      setTimeout(() => {
        this.tabBarProjectClick();
      }, 600);
    },
    handleAwardClick() {
      this.navTabBarIsShow = true;
      setTimeout(() => {
        this.tabBarAwardClick();
      }, 600);
    },
    handleEssayClick() {
      this.navTabBarIsShow = true;
      setTimeout(() => {
        this.tabBarEssayClick();
      }, 600);
    },
    handlePatentClick() {
      this.navTabBarIsShow = true;
      setTimeout(() => {
        this.tabBarPatentClick();
      }, 600);
    },
    handleWorkClick() {
      this.navTabBarIsShow = true;
      setTimeout(() => {
        this.tabBarWorkClick();
      }, 600);
    },
    handleAllClick() {
      this.navTabBarIsShow = true;
      setTimeout(() => {
        this.tabBarAllClick();
      }, 600);
    },
    handleHeaderNavigationBarShow() {
      this.navTabBarIsShow = true;
    },
    // tabBar
    tabBarAllClick() {
      this.clearActive();
      this.navTabBarMarking.all = true;
      this.$nextTick(() => {
        this.$bus.$emit("achievementInit", {
          title: "所有",
          addBtnIsShow: "no",
        });
      });
    },
    tabBarProjectClick() {
      this.clearActive();
      this.navTabBarMarking.project = true;
      this.$nextTick(() => {
        this.$bus.$emit("achievementInit", {
          title: "项目",
        });
      });
    },
    tabBarAwardClick() {
      this.clearActive();
      this.navTabBarMarking.award = true;
      this.$nextTick(() => {
        this.$bus.$emit("achievementInit", {
          title: "获奖",
        });
      });
    },
    tabBarEssayClick() {
      this.clearActive();
      this.navTabBarMarking.essay = true;
      this.$nextTick(() => {
        this.$bus.$emit("achievementInit", {
          title: "论文",
        });
      });
    },
    tabBarPatentClick() {
      this.clearActive();
      this.navTabBarMarking.patent = true;

      this.$nextTick(() => {
        this.$bus.$emit("achievementInit", {
          title: "专利",
        });
      });
    },
    tabBarWorkClick() {
      this.clearActive();
      this.navTabBarMarking.work = true;

      this.$nextTick(() => {
        this.$bus.$emit("achievementInit", {
          title: "著作与教材",
        });
      });
    },
    clearActive() {
      for (const key in this.navTabBarMarking) {
        this.navTabBarMarking[key] = false;
      }
    },
  },
  mounted() {},
  computed: {
    ...mapState(["moreUserInfo", "collegeList"]),
  },
  created() {},
  beforeDestroy() {},
};
</script>

<style lang="less" scoped>
.searchBox {
  display: flex;
  width: 100%;
}
.mask {
  width: 100%;
  height: 82vh;
}
//  <!-- 圆圈视图 -->
.startCircle {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  .main {
    position: relative;
    width: 520px;
    height: 520px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    transform-origin: center center;
    transform: scale(0);
    animation: mainAni 0.5s forwards;
    span {
      position: absolute;
      display: inline-block;
      width: 130px;
      height: 130px;
      background-color: pink;
      border-radius: 50%;
      text-align: center;
      line-height: 130px;
      font-size: 20px;
      font-weight: 700;
      color: white;
      transition: all 0.2s;
      cursor: pointer;
      transform: scale(0);
      &:nth-last-child(1) {
        width: 160px;
        height: 160px;
        left: 180px;
        top: 180px;
        transform-origin: center center;
        line-height: 160px;
        letter-spacing: 10px;
        transform: scale(1) !important;
        &:hover {
          transform-origin: center center;
          font-size: 26px;
        }
      }
      &:nth-of-type(1) {
        left: 194px;
        top: 30px;
      }
      &:nth-of-type(2) {
        left: 24px;
        top: 155px;
        animation-delay: 0.2s;
      }
      &:nth-of-type(3) {
        left: 104px;
        top: 356px;
      }
      &:nth-of-type(4) {
        left: 294px;
        top: 356px;
        animation-delay: 0.6s;
      }
      &:nth-of-type(5) {
        left: 364px;
        top: 155px;
        animation-delay: 0.8s;
      }
      &:hover {
        transform: scale(0.9);
        font-size: 26px;
      }
      animation: circleAni 1s forwards;
    }
    caret-color: transparent;
  }
}

@keyframes circleAni {
  0% {
    transform: scale(0) rotate(0deg);
  }
  100% {
    transform: scale(1) rotate(360deg);
  }
}

@keyframes mainAni {
  100% {
    transform: scale(1);
  }
}

.mainOutAni {
  animation: mainOutAni 0.2s forwards;
}

@keyframes mainOutAni {
  100% {
    transform: scale(0);
  }
}

// <!-- tabBar视图 -->
.navigationBar {
  position: absolute;
  top: 0px;
  left: 50%;
  transform-origin: center center;
  transform: translateX(-50%) scale(0);
  // width: 700px;
  height: 50px;
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 30px;
  z-index: 1111;
  color: white;
  animation: navTabBarAni 0.4s forwards;
  animation-delay: 0.3s;
  // overflow: hidden;
  .main {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    span {
      // width: 80px;
      padding: 6px;
      height: 40px;
      background: pink;
      border-radius: 30px;
      text-align: center;
      line-height: 40px;
      font-size: 20px;
      font-weight: 700;
      margin: 0 10px;
      transition: 0.2s;
      cursor: pointer;
      &:hover {
        transform: scale(1.1);
      }
    }
    .active {
      background-color: orange;
      // filter: brightness(1.1);
      transform: scale(1.1);
    }
    caret-color: transparent;
  }
}

@keyframes navTabBarAni {
  100% {
    transform: translateX(-50%) scale(1);
  }
}
.mask {
  height: 88vh;
}
</style>
